import request from '@/utils/request'
import type { LoginUser, RegisterUser, LoginResponse, UserInfo } from '@/types/data'

// 登录
export const login = (data: LoginUser) => {
  return request<LoginResponse>('user/login', 'POST', data)
}

// 注册
export const register = (data: RegisterUser) => {
  return request('user/register', 'POST', data)
}
// 获取用户信息
export const getUserInfo = () => {
  return request<UserInfo>('user/currentUser', 'GET')
}
// 退出登录
export const exit = () => {
  return request('user/logout', 'GET')
}
